<?php
class Profile_model extends CI_Model {

    var $profile_id = '';
    var $user_name = '';
    var $password_hash = '';
    var $mail = '';
    
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    
    function get_profile($profile_id)
    {
        //$query = $this->db->get('videos_videos', 1);
        $this->db->select('*');
        $this->db->where('user_id', $profile_id);
        $this->db->from('profiles');    
        //$this->db->select('source_id');
        //$this->db->where('media_id', $media_id); 
        //$this->db->from('videos_videos');
        $query = $this->db->get();
        return $query->first_row('array');
    }
    
    function create_profile()
    {
        $data = array(
               'user_name' => $this->input->post('user_name') ,
               'password_hash' => hash("sha256",$this->input->post('password')) ,
               'mail' => $this->input->post('mail')
            );
        $this->db->insert('profiles', $data);
    }
}
?>